package com.terracloud.server.common.data.device.rpc;

import com.terracloud.server.common.data.StringUtils;
import lombok.Getter;

/**
 *
 * @author chenhainan
 * @since 2025/11/7
 */
public enum RpcCommandType {

    SHUTDOWN("shutdown","停止终端"),
    REBOOT("reboot","重启终端"),


    CUSTOME("*","用户自定义")
    ;

    @Getter
    private final String methodName;

    @Getter
    private final String desc;

    RpcCommandType(String methodName, String desc) {
        this.methodName = methodName;
        this.desc = desc;
    }

    public static RpcCommandType getByMethodName(String methodName) {
        if (StringUtils.isEmpty(methodName)) {
            throw new IllegalArgumentException("methodName 不能为空");
        }
        for (RpcCommandType type : RpcCommandType.values()) {
            if (type.getMethodName().equals(methodName)) {
                return type;
            }
        }
        return CUSTOME;
    }


}
